# Maintainer: Alexander F. Rødseth <xyproto@archlinux.org>
# Contributor: Allan McRae <allan@archlinux.org>
# Contributor: Eduard "bekks" Warkentin <eduard.warkentin@gmail.com>
# Contributor: Henning Garus <henning.garus@gmail.com>

pkgname=xdelta3
pkgver=3.1.0
pkgrel=4
pkgdesc='Diff utility for binary files'
arch=(loong64 x86_64)
# No HTTPS available
url='http://xdelta.org/'
license=(Apache)
depends=(ncompress)
makedepends=(git python)
source=("git+https://github.com/jmacd/xdelta#commit=4b4aed71a959fe11852e45242bb6524be85d3709") # tag: v3.1.0
b2sums=(SKIP)

build() {
  cd xdelta/xdelta3

  export CFLAGS="$CFLAGS -w"
  export CXXFLAGS="$CFLAGS -w"

  aclocal
  autoreconf --install
  libtoolize
  autoconf
  autoheader
  automake --add-missing
  automake

  ./configure --disable-dependency-tracking --prefix=/usr --with-liblzma
  make
}

check() {
  cd xdelta/xdelta3/testing

  # Thanks Gentoo <3
  2to3 -w -n --no-diffs *.py
  sed -i -e '/python/s:2.6:2:' xdelta3-regtest.py
  sed -i -e '/python/s:2.7:2:' xdelta3-test.py
  ../xdelta3regtest
}

package() {
  DESTDIR="$pkgdir" make -C xdelta/xdelta3 install
}

# getver: github.com/jmacd/xdelta
